% clustering using kmeans
% A : each row is a sample
% varargin : parameter for multiplicative NMF
% 'k'               : number of cluster
% 'column'          : true for column-wise data
function cluster = kmeansClustering(A, varargin)
    par.k = 5;
    par.column = false;
    par.max_iter = 1e2;
    par = process_parameter(par, varargin{:});
    
    if par.column
        A = A';
    end
    
    opt = statset('MaxIter', par.max_iter);
    cluster = kmeans(A, par.k, 'options', opt, 'EmptyAction', 'singleton');
end
